package com.john.booter.exception;

import org.springframework.http.HttpStatus;

/**
 * 操作成功提示
 */
public class RestSuccess extends RestResult {

	/**
	 * http status
	 */
    private final HttpStatus status;
    private final String message;
    
    
    public RestSuccess(HttpStatus status, String message) {
		super();
		this.status = status;
		this.message = message;
	}
    
    public RestSuccess(String message){
    	this.status = HttpStatus.OK;
    	this.message = message;
    }
    
    public RestSuccess(Msg msg){
    	this.status = HttpStatus.OK;
    	this.message = msg.value();
    }
    
    public HttpStatus getStatus() {
		return status;
	}
    
	public String getMessage() {
		return message;
	}
	
	public static enum Msg{
		isvalid("valid Success"), 
		add("Add Success"),
		delete("Delete Success"),
		update("Update Success"),
		status("Toggle Status Success");
		
		private final String value;
		
		private Msg(String value){
			this.value = value;
		}
		
		public String value() {
			return this.value;
		}
	}
}
